RatingProjectSetForm = Ext.extend(Ext.Window, {
    formPanel : null,
    constructor : function(a) {
        Ext.applyIf(this, a);
        this.initUIComponents();
        RatingProjectSetForm.superclass.constructor.call(this, {
            id : "RatingProjectSetFormWin",
            title : "自评项目名称信息",
            iconCls : "menu-department",
            layout : "fit",
            width : 400,
            height : 230,
            minWidth : 399,
            minHeight : 169,
            items : this.formPanel,
            border : false,
            modal : true,
            plain : true,
            keys : {
                key : Ext.EventObject.ENTER,
                fn : this.save,
                scope : this
            },
            buttonAlign : "center",
            buttons : [ {
                text : "保存",
                iconCls : "btn-save",
                handler : this.save,
                scope : this
            }, {
                text : "取消",
                iconCls : "btn-cancel",
                handler : function() {
                    Ext.getCmp("RatingProjectSetFormWin").close();
                }
            } ]
        });
    },
    initUIComponents : function() {
        this.formPanel = new Ext.form.FormPanel({
            frame : false,
            id : "ratingProjectSetForm",
            bodyStyle : "padding : 5px;",
            layout : "form",
            defaultType : "textfield",
            url : __ctxPath + "/safeachievements/saveRatingProjectSetTree.do",
            defaultType : "textfield",
            reader : new Ext.data.JsonReader({
                root : "data"
            }, [ {
                name : "id",
                mapping : "id"
            }, {
                name : "internalName",
                mapping : "internalName"
            }, {
                name : "internalDesc",
                mapping : "internalDesc"
            },
            {
                name : "parentId",
                mapping : "parentId"
            } ]),
            defaults : {
                anchor : "95%,95%",
                allowBlank : false,
                selectOnFocus : true,
                msgTarget : "side"
            },
            items : [ {
                xtype : "hidden",
                name : "ratingProjectSetTree.id",
                id : "id",
            }, {
                xtype : "hidden",
                name : "ratingProjectSetTree.parentId",
                id : "parentId",
                value : this.nodeId
            },{
                fieldLabel : "名称",
                name : "ratingProjectSetTree.internalName",
                blankText : "名称为必填!",
                id : "internalName"
            }, {
                fieldLabel : "描述",
                xtype : "textarea",
                name : "ratingProjectSetTree.internalDesc",
                blankText : "描述为必填!",
                id : "internalDesc"
            }]
        });
        
    },
    save : function() {
        var a = Ext.getCmp("ratingProjectSetTreePanel");
        if (Ext.getCmp("ratingProjectSetForm").getForm().isValid()) {
            Ext.getCmp("ratingProjectSetForm").getForm().submit({
                waitMsg : "正在提交部门信息",
                success : function(b, c) {
                    Ext.ux.Toast.msg("操作提示", "数据操作成功！");
                    if (a != null) {
                        console.info(a);
                        a.root.reload();
                    }
                    Ext.getCmp("RatingProjectSetFormWin").close();
                }
            });
        }
    }
});